Location: BondGraph Basic @ 38d8a9aa6515 / BG Tutorial Mechanical Systems / FEM Double Pendulum.cellml

Author:
Soroush Safaei <ssaf006@aucklanduni.ac.nz>
Date:
2017-08-17 11:40:48+12:00
Desc:
Merge remote-tracking branch 'origin/master'
Permanent Source URI:
https://models.fieldml.org/workspace/43b/rawfile/38d8a9aa65151ba0e3b2c342731b9488a3e272c9/BG Tutorial Mechanical Systems/FEM Double Pendulum.cellml

<?xml version='1.0'?>
<model name="my_model" xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cellml="http://www.cellml.org/cellml/1.1#" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Multibody problem: FE solution of driven mass on rail with double pin jointed pendulum-->
    <import xlink:href="Units.cellml">
        <units name="per_s" units_ref="per_s"/>
        <units name="m_per_s" units_ref="m_per_s"/>
        <units name="m_per_s2" units_ref="m_per_s2"/>
        <units name="rad_per_s" units_ref="rad_per_s"/>
        <units name="rad_per_s2" units_ref="rad_per_s2"/>
        <units name="J_per_m" units_ref="J_per_m"/>
        <units name="J_per_rad" units_ref="J_per_rad"/>
        <units name="J_per_m2" units_ref="J_per_m2"/>
        <units name="J_s_per_rad" units_ref="J_s_per_rad"/>
        <units name="J_s_per_m" units_ref="J_s_per_m"/>
        <units name="J_s_per_m2" units_ref="J_s_per_m2"/>
        <units name="J_s2_per_m2" units_ref="J_s2_per_m2"/>
    </import>
    <component name="pendulum">
        <variable name="t" units="second"/>
        <!-- State variables-->
        <variable initial_value="0" name="q_A_x" units="metre"/>
        <variable initial_value="0" name="q_A_y" units="metre"/>
        <variable initial_value="0" name="q_B_x" units="metre"/>
        <variable initial_value="-1" name="q_B_y" units="metre"/>
        <variable initial_value="1" name="q_C_x" units="metre"/>
        <variable initial_value="-1" name="q_C_y" units="metre"/>
        <variable initial_value="0" name="v_A_x" units="m_per_s"/>
        <variable initial_value="0" name="v_A_y" units="m_per_s"/>
        <variable initial_value="0" name="v_B_x" units="m_per_s"/>
        <variable initial_value="0" name="v_B_y" units="m_per_s"/>
        <variable initial_value="0" name="v_C_x" units="m_per_s"/>
        <variable initial_value="0" name="v_C_y" units="m_per_s"/>
        <variable name="u_A_x" units="J_per_m"/>
        <variable name="u_A_y" units="J_per_m"/>
        <variable name="u_B_x" units="J_per_m"/>
        <variable name="u_B_y" units="J_per_m"/>
        <variable name="u_C_x" units="J_per_m"/>
        <variable name="u_C_y" units="J_per_m"/>
        <variable name="u_AB_truss" units="J_per_m"/>
        <variable name="u_BC_truss" units="J_per_m"/>
        <variable name="q_theta_AB" units="radian"/>
        <variable name="q_theta_BC" units="radian"/>
        <variable name="q_theta_AB_degree" units="dimensionless"/>
        <variable name="q_theta_BC_degree" units="dimensionless"/>
        <!-- Constitutive parameters-->
        <variable initial_value="1" name="l_AB_0" units="metre"/>
        <variable initial_value="1" name="l_BC_0" units="metre"/>
        <variable name="l_AB" units="metre"/>
        <variable name="l_BC" units="metre"/>
        <variable name="epsilon_AB" units="dimensionless"/>
        <variable name="epsilon_AB_rate" units="per_s"/>
        <variable name="epsilon_BC" units="dimensionless"/>
        <variable name="epsilon_BC_rate" units="per_s"/>
        <variable initial_value="1" name="m_A" units="J_s2_per_m2"/>
        <variable initial_value="1" name="m_B" units="J_s2_per_m2"/>
        <variable initial_value="1" name="m_C" units="J_s2_per_m2"/>
        <variable initial_value="1E4" name="E_AB" units="J_per_m"/>
        <variable initial_value="1E4" name="E_BC" units="J_per_m"/>
        <variable initial_value="10" name="R_AB" units="J_s_per_m"/>
        <variable initial_value="10" name="R_BC" units="J_s_per_m"/>
        <variable initial_value="0" name="F_A_x" units="J_per_m"/>
        <variable initial_value="0" name="F_A_y" units="J_per_m"/>
        <variable initial_value="0" name="F_B_x" units="J_per_m"/>
        <variable initial_value="0" name="F_B_y" units="J_per_m"/>
        <variable initial_value="0" name="F_C_x" units="J_per_m"/>
        <variable initial_value="0" name="F_C_y" units="J_per_m"/>
        <variable initial_value="9.81" name="g" units="m_per_s2"/>
        <!-- Beam equations-->
        <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
                <eq/>
                <ci>l_AB</ci>
                <apply>
                    <root/>
                    <apply>
                        <plus/>
                        <apply>
                            <power/>
                            <apply>
                                <minus/>
                                <ci>q_B_x</ci>
                                <ci>q_A_x</ci>
                            </apply>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                        <apply>
                            <power/>
                            <apply>
                                <minus/>
                                <ci>q_B_y</ci>
                                <ci>q_A_y</ci>
                            </apply>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>l_BC</ci>
                <apply>
                    <root/>
                    <apply>
                        <plus/>
                        <apply>
                            <power/>
                            <apply>
                                <minus/>
                                <ci>q_C_x</ci>
                                <ci>q_B_x</ci>
                            </apply>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                        <apply>
                            <power/>
                            <apply>
                                <minus/>
                                <ci>q_C_y</ci>
                                <ci>q_B_y</ci>
                            </apply>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>q_theta_AB</ci>
                <apply>
                    <arccos/>
                    <apply>
                        <divide/>
                        <apply>
                            <minus/>
                            <ci>q_A_x</ci>
                            <ci>q_B_x</ci>
                        </apply>
                        <ci>l_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>q_theta_BC</ci>
                <apply>
                    <arccos/>
                    <apply>
                        <divide/>
                        <apply>
                            <minus/>
                            <ci>q_B_x</ci>
                            <ci>q_C_x</ci>
                        </apply>
                        <ci>l_BC</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>q_theta_AB_degree</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <ci>q_theta_AB</ci>
                        <cn cellml:units="dimensionless">180</cn>
                    </apply>
                    <pi/>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>q_theta_BC_degree</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <ci>q_theta_BC</ci>
                        <cn cellml:units="dimensionless">180</cn>
                    </apply>
                    <pi/>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>epsilon_AB</ci>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <ci>l_AB</ci>
                        <ci>l_AB_0</ci>
                    </apply>
                    <ci>l_AB_0</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>epsilon_BC</ci>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <ci>l_BC</ci>
                        <ci>l_BC_0</ci>
                    </apply>
                    <ci>l_BC_0</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>epsilon_AB_rate</ci>
                <apply>
                    <divide/>
                    <apply>
                        <plus/>
                        <apply>
                            <times/>
                            <apply>
                                <minus/>
                                <ci>q_B_x</ci>
                                <ci>q_A_x</ci>
                            </apply>
                            <apply>
                                <minus/>
                                <ci>v_B_x</ci>
                                <ci>v_A_x</ci>
                            </apply>
                        </apply>
                        <apply>
                            <times/>
                            <apply>
                                <minus/>
                                <ci>q_B_y</ci>
                                <ci>q_A_y</ci>
                            </apply>
                            <apply>
                                <minus/>
                                <ci>v_B_y</ci>
                                <ci>v_A_y</ci>
                            </apply>
                        </apply>
                    </apply>
                    <apply>
                        <times/>
                        <ci>l_AB</ci>
                        <ci>l_AB_0</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>epsilon_BC_rate</ci>
                <apply>
                    <divide/>
                    <apply>
                        <plus/>
                        <apply>
                            <times/>
                            <apply>
                                <minus/>
                                <ci>q_C_x</ci>
                                <ci>q_B_x</ci>
                            </apply>
                            <apply>
                                <minus/>
                                <ci>v_C_x</ci>
                                <ci>v_B_x</ci>
                            </apply>
                        </apply>
                        <apply>
                            <times/>
                            <apply>
                                <minus/>
                                <ci>q_C_y</ci>
                                <ci>q_B_y</ci>
                            </apply>
                            <apply>
                                <minus/>
                                <ci>v_C_y</ci>
                                <ci>v_B_y</ci>
                            </apply>
                        </apply>
                    </apply>
                    <apply>
                        <times/>
                        <ci>l_BC</ci>
                        <ci>l_BC_0</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_AB_truss</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>E_AB</ci>
                        <ci>epsilon_AB</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>R_AB</ci>
                        <ci>epsilon_AB_rate</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_BC_truss</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>E_BC</ci>
                        <ci>epsilon_BC</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>R_BC</ci>
                        <ci>epsilon_BC_rate</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_A_x</ci>
                <apply>
                    <times/>
                    <apply>
                        <minus/>
                        <ci>u_AB_truss</ci>
                    </apply>
                    <apply>
                        <cos/>
                        <ci>q_theta_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_A_y</ci>
                <apply>
                    <times/>
                    <apply>
                        <minus/>
                        <ci>u_AB_truss</ci>
                    </apply>
                    <apply>
                        <sin/>
                        <ci>q_theta_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_B_x</ci>
                <apply>
                    <minus/>
                    <apply>
                        <times/>
                        <ci>u_AB_truss</ci>
                        <apply>
                            <cos/>
                            <ci>q_theta_AB</ci>
                        </apply>
                    </apply>
                    <apply>
                        <times/>
                        <ci>u_BC_truss</ci>
                        <apply>
                            <cos/>
                            <ci>q_theta_BC</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_B_y</ci>
                <apply>
                    <minus/>
                    <apply>
                        <times/>
                        <ci>u_AB_truss</ci>
                        <apply>
                            <sin/>
                            <ci>q_theta_AB</ci>
                        </apply>
                    </apply>
                    <apply>
                        <times/>
                        <ci>u_BC_truss</ci>
                        <apply>
                            <sin/>
                            <ci>q_theta_BC</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_C_x</ci>
                <apply>
                    <times/>
                    <ci>u_BC_truss</ci>
                    <apply>
                        <cos/>
                        <ci>q_theta_BC</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_C_y</ci>
                <apply>
                    <times/>
                    <ci>u_BC_truss</ci>
                    <apply>
                        <sin/>
                        <ci>q_theta_BC</ci>
                    </apply>
                </apply>
            </apply>
            <!-- Constitutive relations-->
            <!--        ode(v_A_x, t) = (-F_A_x-u_AB_truss*cos(q_theta_AB))/m_A;
        ode(v_A_y, t) = (-F_A_y-u_AB_truss*sin(q_theta_AB))/m_A-g;-->
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_B_x</ci>
                </apply>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <apply>
                            <plus/>
                            <ci>F_B_x</ci>
                            <apply>
                                <times/>
                                <ci>u_AB_truss</ci>
                                <apply>
                                    <cos/>
                                    <ci>q_theta_AB</ci>
                                </apply>
                            </apply>
                        </apply>
                        <apply>
                            <times/>
                            <ci>u_BC_truss</ci>
                            <apply>
                                <cos/>
                                <ci>q_theta_BC</ci>
                            </apply>
                        </apply>
                    </apply>
                    <apply>
                        <plus/>
                        <ci>m_B</ci>
                        <ci>m_C</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_B_y</ci>
                </apply>
                <apply>
                    <minus/>
                    <apply>
                        <divide/>
                        <apply>
                            <minus/>
                            <apply>
                                <plus/>
                                <ci>F_B_y</ci>
                                <apply>
                                    <times/>
                                    <ci>u_AB_truss</ci>
                                    <apply>
                                        <sin/>
                                        <ci>q_theta_AB</ci>
                                    </apply>
                                </apply>
                            </apply>
                            <apply>
                                <times/>
                                <ci>u_BC_truss</ci>
                                <apply>
                                    <sin/>
                                    <ci>q_theta_BC</ci>
                                </apply>
                            </apply>
                        </apply>
                        <apply>
                            <plus/>
                            <ci>m_B</ci>
                            <ci>m_C</ci>
                        </apply>
                    </apply>
                    <ci>g</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_C_x</ci>
                </apply>
                <apply>
                    <divide/>
                    <apply>
                        <plus/>
                        <ci>F_C_x</ci>
                        <apply>
                            <times/>
                            <ci>u_BC_truss</ci>
                            <apply>
                                <cos/>
                                <ci>q_theta_BC</ci>
                            </apply>
                        </apply>
                    </apply>
                    <ci>m_C</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_C_y</ci>
                </apply>
                <apply>
                    <minus/>
                    <apply>
                        <divide/>
                        <apply>
                            <plus/>
                            <ci>F_C_y</ci>
                            <apply>
                                <times/>
                                <ci>u_BC_truss</ci>
                                <apply>
                                    <sin/>
                                    <ci>q_theta_BC</ci>
                                </apply>
                            </apply>
                        </apply>
                        <ci>m_C</ci>
                    </apply>
                    <ci>g</ci>
                </apply>
            </apply>
            <!-- Conservation laws-->
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_A_x</ci>
                </apply>
                <ci>v_A_x</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_A_y</ci>
                </apply>
                <ci>v_A_y</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_B_x</ci>
                </apply>
                <ci>v_B_x</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_B_y</ci>
                </apply>
                <ci>v_B_y</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_C_x</ci>
                </apply>
                <ci>v_C_x</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_C_y</ci>
                </apply>
                <ci>v_C_y</ci>
            </apply>
        </math>
    </component>
</model>